# -*- coding: utf-8 -*-

"""
feedjack
Gustavo Picón
urls.py
"""

from django.conf.urls.defaults import *
from django.views.generic.simple import redirect_to

from feedjack import views



urlpatterns = patterns('',
    (r'^rss20.xml$', redirect_to,
      {'url':'/feed/rss/'}),
    (r'^feed/$', redirect_to,
      {'url':'/feed/atom/'}),
    url(r'^feed/rss/$', views.rssfeed, name='feedjack_rss'),
    url(r'^feed/atom/$', views.atomfeed, name='feedjack_atom'),

    url(r'^feed/user/(?P<user>\d+)/tag/(?P<tag>.*)/$', redirect_to,
      {'url':'/feed/atom/user/%(user)s/tag/%(tag)s/'}, name='feedjack_usertagredirect'),
    url(r'^feed/user/(?P<user>\d+)/$', redirect_to,
      {'url':'/feed/atom/user/%(user)s/'}, name='feedjack_userredirect'),
    url(r'^feed/tag/(?P<tag>.*)/$', redirect_to,
      {'url':'/feed/atom/tag/%(tag)s/'}, name='feedjack_tagredirect'),

    url(r'^feed/atom/user/(?P<user>\d+)/tag/(?P<tag>.*)/$', views.atomfeed, name='feedjack_useratomtag'),
    url(r'^feed/atom/user/(?P<user>\d+)/$', views.atomfeed, name='feedjack_atomuser'),
    url(r'^feed/atom/tag/(?P<tag>.*)/$', views.atomfeed, name='feedjack_atomtag'),
    url(r'^feed/rss/user/(?P<user>\d+)/tag/(?P<tag>.*)/$', views.rssfeed, name='feedjack_rssusertag'),
    url(r'^feed/rss/user/(?P<user>\d+)/$', views.rssfeed, name='feedjack_rssuser'),
    url(r'^feed/rss/tag/(?P<tag>.*)/$', views.rssfeed, name='feedjack_rsstag'),

    url(r'^user/(?P<user>\d+)/tag/(?P<tag>.*)/$', views.mainview, name='feedjack_usertag'),
    url(r'^user/(?P<user>\d+)/$', views.mainview, name='feedjack_user'),
    url(r'^tag/(?P<tag>.*)/$', views.mainview, name='feedjack_tag'),

    url(r'^opml/$', views.opml, name='feedjack_opml'),
    url(r'^foaf/$', views.foaf, name='feedjack_foaf'),
    url(r'^$', views.mainview, name='feedjack_main'),
)
